<template>
  <div>
    <div id="vip-choose-wrap" class="">
      <div class="all-vip-choose">
        <div class="vip-choose-item" v-for="(item, index) in authList" :key="item.id">
          <div
            class="vip-cho-top"
            :style="{ 'background-position-x': getBackgroundColor(index) }"
          >
            <p class="vip-cho-title">{{ item.authType }}</p>
          </div>
          <div class="vip-cho-content">
            <p class="vip-cho-price">
              <!-- <em>￥</em> -->
              <span>{{ item.price }}</span>
              <!-- <em>元</em> -->
            </p>
            <p class="vip-cho-intro block">{{ item.downAuthority }}</p>
            <div class="vip-cho-cut">授权范围</div>
            <p class="vip-cho-intro2" v-for="child in item.authDescList" :key="child.id">
              {{ child }}
            </p>
          </div>
          <div
            class="join-vip"
            data-abfrom="18"
            data-index="0"
            @click="enterpriseClick(item)"
          >
            立即购买
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, ref, defineEmits } from "vue";
import { getauthTypeList } from "@/common/listApi";
import { postOrderType } from "@/common/utils/userType";
import { userorderStore } from "@/store/orderStore";
import { useRouter } from "vue-router";
const router = useRouter();
const orderStore = userorderStore();

// 获取会员授权列表
const authList = ref<any>(null);
getauthTypeList(1).then((res) => {
  console.log(res.data, "sho0uquan");
  authList.value = res.data;
});
const getBackgroundColor = (index: number) => {
  // 根据索引返回不同的颜色值
  return -280 * (index + 1) + "px";
};
// 立即购买
let data = reactive<postOrderType | any>({
  orderType: "0",
  orderAmount: "",
  payType: "1",
  itemBos: [
    {
      itemType: "0",
      itemId: "",
      itemName: "",
      itemAmount: "",
      quantity: 1,
      baseAmount: "",
      thumbnailUrl:
        "https://hynamic002.oss-cn-beijing.aliyuncs.com/2024/06/17/bc67184696b5484bacc2803c53386346.jpg",
    },
  ],
});
const emit = defineEmits(["update:visible"]);
const enterpriseClick = (item: any) => {
  data.orderAmount = item.price;
  data.itemBos[0].itemId = item.id;
  data.itemBos[0].itemName = item.authType;
  data.itemBos[0].itemAmount = item.price;
  data.itemBos[0].baseAmount = item.price;
  console.log(data);
  orderStore.updataPostOrderData(data);
  localStorage.setItem("orderData", JSON.stringify(data));
  // localOpenAuth.value = false;
  emit("update:visible", false);
  router.push({ name: "buy" });
};
</script>

<style lang="scss" scoped>
#vip-choose {
  background: #f2f3f6;
  padding-bottom: 50px;
}
#vip-choose-wrap {
  width: 1000px;
  margin: 0 auto;
  text-align: center;
  box-sizing: border-box;
  padding-bottom: 100px;
}
#vip-choose h3 {
  font-size: 24px;
  line-height: 24px;
  height: 24px;
  margin-bottom: 30px;
  color: #333333;
  margin-top: -6px;
}
.all-vip-choose {
  width: 1000px;
  margin: 0 auto;
  padding-bottom: 50px;
  box-sizing: border-box;
  height: 456px;
}
.vip-choose-item {
  width: 295px;
  height: 500px;
  margin-right: 30px;
  border-radius: 10px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.1);
  position: relative;
  float: left;
  background: #ffffff;
}
.recommend-item {
  left: 0;
  top: 0;
  width: 63px;
  height: 63px;
  background: url(//static.699pic.com/images/enterprise-newui.png) no-repeat;
  background-position: -1141px -10px;
}
.vip-cho-top {
  height: 88px;
  background: url(//static.699pic.com/images/enterprise-newui.v2.png) no-repeat;
  background-position: 0 0;
  box-sizing: border-box;
  padding-top: 18px;
  color: #ffffff;
  border-radius: 10px 10px 0 0;
}
.vip-cho-title {
  font-size: 20px;
  line-height: 20px;
  height: 20px;
  margin-bottom: 10px;
}
.vip-cho-desc {
  font-size: 14px;
  line-height: 14px;
}
.vip-cho-content {
  text-align: center;
}
.vip-cho-plus {
  height: 40px;
  margin-top: -2px;
  font-size: 30px;
  color: #333333;
  line-height: 40px;
  margin-bottom: 12px;
}
.vip-cho-price {
  height: 40px;
  margin-top: -2px;
  position: relative;
  display: inline-block;
  margin-bottom: 12px;
}
.vip-cho-price span {
  color: #c50200;
  font-size: 40px;
  line-height: 40px;
  font-weight: 700;
}
.vip-cho-price em {
  position: absolute;
  right: -25px;
  bottom: 0;
  font-size: 14x;
  color: #c50200;
  line-height: 14px;
  font-style: normal;
}
.vip-cho-intro {
  font-size: 14px;
  color: #666666;
  line-height: 24px;
  position: relative;
}
.api_link:hover {
  color: #2caeff;
}
.vip-cho-intro2 {
  font-size: 14px;
  line-height: 24px;
  color: #333333;
  // font-weight: 600;
  // text-align: left;
  padding: 0 10px 5px;
}
.vip-cho-intro3 {
  line-height: 24px;
  font-size: 14px;
  color: #333333;
  font-weight: 600;
}
.vip-cho-intro span {
  position: absolute;
  right: -20px;
  top: 0;
  display: inline-block;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
  z-index: 1;
}
.vip-cho-intro span i {
  font-size: 14px;
  color: #2f9fda;
}
.vip-cho-intro span em {
  position: absolute;
  width: 180px;
  height: 0;
  background: #666666;
  box-sizing: border-box;
  color: #ffffff;
  line-height: 18px;
  left: -83px;
  top: 25px;
  font-style: normal;
  transition: height 0.2s;
  border-radius: 4px;
  font-size: 12px;
}
.vip-cho-intro span:hover {
  overflow: visible;
}
.vip-cho-intro span:hover em {
  height: auto;
  padding: 10px 16px;
}
.vip-choose-plus .vip-cho-intro span:hover em {
  padding: 10px;
}
.vip-cho-intro span:hover em::before {
  content: "";
  width: 10px;
  height: 10px;
  background: #666666;
  transform: rotate(45deg);
  display: block;
  position: absolute;
  left: 50%;
  margin-left: -5px;
  top: -5px;
}
.vip-cho-cut {
  height: 30px;
  background: linear-gradient(
    270deg,
    rgba(243, 244, 247, 0) 0%,
    #f3f4f7 50%,
    rgba(243, 244, 247, 0) 100%
  );
  font-size: 14px;
  color: #333333;
  line-height: 30px;
  text-align: center;
  margin: 16px auto 13px;
}
.vip-choose-item .join-vip {
  display: block;
  width: 200px;
  height: 40px;
  border-radius: 20px;
  background: #c50200;
  font-size: 18px;
  color: #ffffff;
  line-height: 40px;
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  margin: auto;
  cursor: pointer;
}
.vip-choose-item .join-vip:hover {
  background: #ea4e03;
}
.vip-choose-item .join-vip.qiye:hover span {
  background-image: linear-gradient(270deg, #08b7ff 0%, #9509ff 100%);
  color: #fff;
}
.vip-choose-item .join-vip.qiye {
  overflow: hidden;
  background-image: linear-gradient(270deg, #08b7ff 0%, #9509ff 100%);
}
.vip-choose-item .join-vip.qiye span {
  margin: 1px 0 0 1px;
  font-size: 16px;
  color: #5d70ff;
  letter-spacing: 0;
  text-align: center;
  background-color: #fff;
  width: 148px;
  height: 38px;
  line-height: 38px;
  display: block;
  border-radius: 40px;
}
#vip-choose-wrap > p,
.privileged-service .service-links {
  text-align: center;
  height: 14px;
}
#vip-choose-wrap > p a {
  color: #39aeff;
  font-size: 14px;
  user-select: none;
  cursor: pointer;
  line-height: 14px;
}
.privileged-service .service-links a {
  margin: 0 9px;
  color: #39aeff;
  font-size: 14px;
  user-select: none;
  cursor: pointer;
  line-height: 14px;
  display: inline-block;
}

#our-quality h3 {
  font-size: 24px;
  text-align: center;
  color: #333;
  padding-top: 3px;
  margin-bottom: 4px;
}
#our-quality .quality-desc {
  text-align: center;
  margin-bottom: 30px;
}
.quality-wrapper {
  position: relative;
  width: 1100px;
  height: 360px;
  border-radius: 10px;
  margin: 0 auto;
  margin-bottom: -22px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.16);
}
.quality-box {
  width: 100%;
  height: 100%;
}
.quality-btn {
  position: absolute;
  top: 50%;
  margin-top: -28px;
  color: #dddddd;
  cursor: pointer;
}
.quality-btn .iconfont {
  font-size: 42px;
  transition: 0.2s;
}
.quality-btn:hover .iconfont {
  color: #2caeff;
}
.quality-btn-left {
  left: -62px;
}
.quality-btn-right {
  right: -62px;
}
.quality-box {
  height: 360px;
  overflow: hidden;
}
.quality-item {
  border-radius: 10px;
  overflow: hidden;
}
.quality-item-r {
  width: 710px;
  height: 360px;
}
.quality-item-l {
  width: 265px;
  padding-left: 40px;
  padding-top: 63px;
}
.quality-item-title {
  font-size: 50px;
  color: #333;
}
.quality-item-title2 {
  font-size: 24px;
  color: #333;
}
.quality-item-hint {
  font-size: 14px;
  color: #666;
  line-height: 24px;
  margin-top: 22px;
}

.bottom-body {
  background: #fff;
  height: 165px;
  box-sizing: border-box;
  padding-top: 35px;
  text-align: center;
  border-bottom: 1px solid #dddddd;
}
.bottom-body .bottom-btn {
  display: inline-block;
  width: 440px;
  height: 60px;
  line-height: 60px;
  border-radius: 30px;
  background: #39aeff;
  color: #fff;
  font-size: 24px;
}
.bottom-body .bottom-btn:hover {
  background: #2c9eec;
}
.bottom-body .bottom-hint {
  font-size: 14px;
  color: #999;
  padding-top: 20px;
}
.bottom-body .bottom-hint span {
  color: #39aeff;
  cursor: pointer;
}
.bottom-body .bottom-hint span:hover {
  color: #2c9eec;
}
</style>
